package cn.wikiflyer.beikang.act.cart.util;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import cn.wikiflyer.beikang.R;

public class ToastView extends Dialog {

	public ToastView(Context context, int theme) {
		super(context, theme);
	}

	public ToastView(Context context) {
		super(context);
	}

	public static class Builder {
		private Context context;
		
		private TextView tv_name,tv_phone,tv_email;

		public Builder(Context context) {
			this.context = context;
		}

		public ToastView create(String name,final ClickListener listener) {
			LayoutInflater inflater = (LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			final ToastView Mydialog = new ToastView(context, R.style.Dialog);
			Mydialog.setCanceledOnTouchOutside(false);
			View layout = inflater.inflate(R.layout.toast_dialog_view_lay, null);
			((TextView)layout.findViewById(R.id.tv_name)).setText(name);
			((TextView)layout.findViewById(R.id.textView_ok)).setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View arg0) {
					Mydialog.dismiss();
					listener.clickOK();
				}
			});
			Mydialog.setContentView(layout);
			return Mydialog;
		}
	}
	public interface ClickListener{
		public void clickOK();
	}

}